#include <QtGui/QApplication>
#include "mainwindow.h"
#include <QDesktopWidget>
#include <QDebug>

#include <iostream>
using namespace std;

void center(QWidget &widget)
{
  int x, y;
  int screenWidth;
  int screenHeight;

  int WIDTH = 640;
  int HEIGHT = 640;

  QDesktopWidget *desktop = QApplication::desktop();

  screenWidth = desktop->width();
  screenHeight = desktop->height();

  x = (screenWidth - WIDTH) / 2;
  y = (screenHeight - HEIGHT) / 2;

  widget.setGeometry(x, y, WIDTH, HEIGHT);
  widget.setFixedWidth(WIDTH);
  widget.setFixedHeight(HEIGHT);
}

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    QString filepath = argv[0];
    filepath = filepath.mid(0, filepath.lastIndexOf('\\') + 1);
    QString gameFile = "new game";

    MainWindow w(filepath, gameFile);

    w.show();
    center(w);

    return a.exec();
}
